package org.example.base.listener;

import org.example.auth.service.IPermissionScanService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class InitDataListener implements ServletContextListener {
    @Autowired
    private IPermissionScanService scanService;

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("监听到项目启动...开始......");
        try {
            scanService.scan();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        System.out.println("监听到项目启动...结束......");


    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {

    }
}
